﻿<div class="widget">
    <div class="widget-header bordered-bottom bordered-sky">
        <span class="widget-caption"><h4><?=$exam['cname'];?></h4></span>
        <div class="widget-buttons">
        	<a class="refresh" id="refresh-toggler" href="" title="刷新">
                <i class="glyphicon glyphicon-refresh"></i>
            </a>
	        <a href="#" data-toggle="maximize" title="最大化">
	            <i class="fa fa-expand warning"></i>
	        </a>
	        <a href="#" data-toggle="collapse" title="最小化">
	            <i class="fa fa-minus red"></i>
	        </a>
	    </div>
    </div><!--Widget Header-->
    <div class="widget-body">
       <table class="table table-striped table-hover table-bordered dataTable no-footer" id="editabledatatable" aria-describedby="editabledatatable_info">
			<thead class="bordered-bottom-1 bordered-orange">
			<tr>
				<th class="text-center">学号</th>
				<th class="text-center">姓名</th>
				<th class="text-center">登录IP</th>
				<th class="text-center">最后登录时间</th>
				<th class="text-center">状态</th>
				<th class="text-center">考场记录</th>
				<th class="text-center">操作</th>
			</tr>
			</thead>
			<tbody>
			<?php
			if( empty( $tests ) ):
			?>
			<tr>
				<th colspan="6" class="text-center">该场考试没有考生！</th>
			</tr>
			<?php
			else:
				foreach( $tests as $m ):?>
			<tr>
				<td class="text-center"><?=$m['sid'];?></td>
				<td class="text-center"><?=$m['sname'];?></td>
				<td class="text-center"><?=$m['ip'];?></td>
				<td class="text-center"><?=$m['login_time'];?></td>
				<td class="text-center"><?=$m['status'];?></td>
				<td class="text-center"><?=$m['remark'];?></td>
				<td class="text-center" style="width: 300px;">
					<button class="btn btn-warning btn-xs edit" onclick="show_modal( 'modal', '<?=site_url( 'exam/remark') . '/' .$m['sid'];?>')"><i class="fa fa-pencil"></i> 考场记录</button>
					<button class="btn btn-success btn-xs delete" onclick="bb_confirm( '确定要强制【<?=$m['sid'].$m['sname'];?>】重考？', '<?=site_url('exam/reset_exam'). '/' .$m['sid'];?>')"><i class="fa fa-refresh"></i> 重考</button>
					<button class="btn btn-danger btn-xs delete" onclick="bb_confirm( '确定要强制【<?=$m['sid'].$m['sname'];?>】交卷？', '<?=site_url('exam/handin'). '/' .$m['sid'];?>')"><i class="fa fa-cloud-upload"></i> 强制交卷</button>
				</td>
			</tr>
			<?php
				endforeach;
			endif;
			?>
			</tbody>
		</table>
    </div><!--Widget Body-->
</div>

<script>
$('#add_exam').click(function(){
	var input_time = $("#time").val();
	var time = input_time.replace( /T/, ' ' );
	alert( time );
	ajax_post(
		'<?=site_url( 'exam/add_exam' );?>',
		{
			class:$("#class").val(),
			time:time,
		}
	);}
);
</script>